import { getRequest } from "@/api/request";
import { AxiosResponse } from "axios";
// import { translateCount } from "@/utils/util";
const REQUEST_URL = {
  banner: "/banner?type=2",
};

export interface InBanner {
  typeTitle: string;
  pic: string;
}

const filter = (res: AxiosResponse) => {
  //   console.log(res, 123);
  return res.data.banners.map((it: InBanner) => {
    return {
      typeTitle: it.typeTitle,
      pic: it.pic,
    };
  });
};

export const getBanner = () => {
  return getRequest(REQUEST_URL.banner).then(filter);
};
